home *** CD-ROM | disk | FTP | other *** search
- # (decoded with TMPL 11972)
- { %filename% }
- { Created %date% %time% by AppMaker }
-
- Unit %unitname%;
- Interface
-
- %If MPW%
- Uses
- {$Load ToolBox.dump}
- MemTypes,
- QuickDraw,
- OSIntf,
- ToolIntf,
- PackIntf;
- {$Load}
-
- %end if%
- %If Think%
- {$ifc undefined Think_Pascal}
- Uses
- ListManager;
-
- {$endc}
- %end if%
- Type
- WinInfoRec = record
- {Standard fields:}
- text: TEHandle;
- vScroll: ControlHandle;
- hScroll: ControlHandle;
- fileNum: integer;
- volNum: integer;
- dirty: boolean;
- filename: StringHandle;
- windowKind: (noWindow%windowKinds%, fillerWK);
-
- {Application-specific fields:}
- %DeclGlobals%
- end; {WinInfoRec}
- WinInfoPtr = ^WinInfoRec;
-
- var
- quittingTime: boolean;
- curEvent: EventRecord;
- curWindow: WindowPtr;
- cur: WinInfoPtr;
- inBackground: boolean;
-
- {----------}
- Procedure InitGlobals;
- Procedure SetInfo (window: WindowPtr);
- Procedure SetNewInfo (window: WindowPtr);
- Procedure DiscardInfo (window: WindowPtr);
-
- {----------}
- Implementation
-
- %If MPW%
- {$D+}
- {$R+}
- {$OV+}
-
- %end if%
- var
- noCur: WinInfoRec;
-
- %If MPW%
- {$S %unitname%}
-
- %end if%
- {----------}
- Procedure InitGlobals;
- Begin
- curWindow := nil;
- with noCur do begin
- text := nil;
- vScroll := nil;
- hScroll := nil;
- fileNum := 0;
- volNum := 0;
- dirty := false;
- windowKind := noWindow;
- end; {with}
- cur := @noCur;
- End; {InitGlobals}
-
- {----------}
- Procedure SetInfo {(window: WindowPtr)};
- var
- infoPtr: WinInfoPtr;
- Begin
- if window <> curWindow then begin
- curWindow := window;
- if curWindow <> nil then begin
- infoPtr := WinInfoPtr (GetWRefCon (curWindow));
- cur := infoPtr;
- end else begin
- cur := @noCur;
- end; {if}
- end; {if}
- End; {SetInfo}
-
- {----------}
- Procedure SetNewInfo {(window: WindowPtr)};
- var
- infoPtr: WinInfoPtr;
- Begin
- infoPtr := WinInfoPtr (NewPtr (sizeof (WinInfoRec)));
- SetWRefCon (window, longint (infoPtr));
- SetInfo (window);
- End; {SetNewInfo}
-
- {----------}
- Procedure DiscardInfo {(window: WindowPtr)};
- var
- infoPtr: WinInfoPtr;
- Begin
- if window = curWindow then begin
- SetInfo (nil);
- end;
- infoPtr := WinInfoPtr (GetWRefCon (window));
- DisposPtr (Ptr (infoPtr));
- HideWindow (window);
- DisposeWindow (window);
- End; {DiscardInfo}
-
- End. {%unitname%}
-
-